<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<form  id="form">
			姓名：<input type="text" name="user">
			性别：<input type="radio" name="gender" value="m">男
			<input type="radio" name="gender" value="w">女
			<input type="checkbox"  name="hobby[]" value="swimming"/>游泳
			<input type="checkbox"  name="hobby[]" value="reading"/>读书
			<input type="checkbox"  name="hobby[]" value="running"/>跑步
			<select name="area">
				<option>--请选择--</option>
				<option value="bj">北京</option>
				<option value="sh">上海</option>
				<option value="sz">深圳</option>
			</select>
			自我介绍：<textarea  name="introduce" rows="5" cols="50"></textarea>
			<input type="submit" value="提交">
		</form>
		<script type="text/javascript" src="FormBuilder.js" ></script>
		<script>
		var elements=[{
				tag: 'input',
				text:'姓名：',
				attr:{type;'text',name:'user'},
				option:null
		},			
			{
				tag: 'input',
				text:'性别：',
				attr: {type;'radio',name:'gender'},
				option:{m:男,w:女}
			},
			{
				tag: 'input',
				text:'爱好：',
				attr:{type;'checkbox',name:'hobby[]'},
				option:{swimming:'游泳',reading:'读书',running:'跑步'}
			},
			{
				tag: 'select',
				text:'住址：',
				attr:{name:'area'},
				option:{'':'--请选择--',bj:'北京',sh:'上海',sz:'深圳'}
			},
			{
				tag:'textarea',
				text:'自我介绍：',
				attr:{
					name:'introduce',rows:'5',cols:'50'
				},
				option:null
			},
			{
				tag: 'select',
				text:'',
				attr:{type='submit' value='提交'},
				option:null
			}];
		var html=new FormBuilder(elements).create();
		document.getElementById('form').innerHTML=html
		</script>
	</body>
</html>
